package cn.xfdzx.android.apps.shop.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.xfdzx.android.apps.shop.R;
import cn.xfdzx.android.apps.shop.bean.OrderWuliuDaMaBeen;
import cn.xfdzx.android.apps.shop.bean.OrderWuliuShunFengBeen;
import cn.xfdzx.android.apps.shop.contract.ItemClickListener;

/**
 * @author gzk
 * @date 2020/4/13 0013
 * description：新发地物流跟踪顺丰
 */
public class XFDWuliuShunFengAdapter extends RecyclerView.Adapter<XFDWuliuShunFengAdapter.MyViewHolder> {

    private ItemClickListener mItemClickListener;
    private List<OrderWuliuShunFengBeen.DataBean.RoutersBean> mList;
    private Context context;


    public XFDWuliuShunFengAdapter(Context context, List<OrderWuliuShunFengBeen.DataBean.RoutersBean> list) {
        this.mList = list;
        this.context = context;
    }

    @NonNull
    @Override
    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_xfd_wuliu, parent, false);
        MyViewHolder myHolder = new MyViewHolder(inflate);

        return myHolder;
    }

    @Override
    public void onBindViewHolder(@NonNull final MyViewHolder holder, final int position) {
        holder.tvWuliuInfo.setText( mList.get(position).getStatus_desc());
        holder.tvInfoRen.setText( mList.get(position).getOperate_address() );
        holder.tvWuliuTime.setText(mList.get(position).getOperate_time());
    }


    @Override
    public int getItemCount() {
        return mList.size();
    }

    class MyViewHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.tv_info_ren)
        TextView tvInfoRen;
        @BindView(R.id.tv_wuliu_info)
        TextView tvWuliuInfo;
        @BindView(R.id.tv_wuliu_time)
        TextView tvWuliuTime;


        public MyViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);

        }
    }


    public void setOnItemClickListener(ItemClickListener itemClickListener) {
        this.mItemClickListener = itemClickListener;

    }

}
